mui.init({  
	   subpages:[//先加载首页  
           {  
              url:'main.html',  
              id:'index',  
              styles:{  
                 top:'0px',  
                 bottom:'49px',  
              } 
           },
          ], 
        preloadPages:[//缓存其他页面  
            {  
              url:'dynamics.html',  
              id:'dynamics',  
              styles:{  
                top:'0px',  
                 bottom:'49px',  
              }  
            },  
            {  
              url:'posted.html',  
              id:'posted',  
              styles:{  
                top:'0px',  
                 bottom:'49px',    
              }  
            },
            {  
              url:'news.html',  
              id:'news',  
              styles:{  
               top:'0px',  
                 bottom:'49px',  
              }  
            } ,
            {  
              url:'mineCenter.html',  
              id:'mineCenter',  
              styles:{  
                top:'0px',  
                 bottom:'49px',   
              }  
            },
            {  
              url:'login.html',  
              id:'login',  
              styles:{  
                top:'0px',  
                 bottom:'0px',   
              }  
            }
            
            
        ]  
          
    });  
mui.plusReady(function(){   
    // 获取所有Webview窗口
    var winAll=plus.webview.all();//获取所有窗体  
    //顶部导航
 
    //底部导航
      var index,dynamics,posted,news,mineCenter
    mui("#nav").on("tap","#index",function(){//点击触发   
        index=plus.webview.getWebviewById("index");  
        index.show()  
        dynamics.hide();
        posted.hide();
        news.hide();
        mineCenter.hide();
    })  
    mui("#nav").on("tap","#dynamics",function(){//点击触发  
        dynamics=plus.webview.getWebviewById("dynamics"); 
        dynamics.show()
          
    })  
    mui("#nav").on("tap","#posted",function(){//点击触发 
		var userInfo=localStorage.getItem('userInfo');
		if(!userInfo){
			webtool.openPreView('login',function(wb){
				wb.show('slide-in-right',300);
			})
		}else{
			posted=plus.webview.getWebviewById("posted");  
	        posted.show()  	
		}
          
    })  
    mui("#nav").on("tap","#news",function(){//点击触发  
    	var userInfo=localStorage.getItem('userInfo');
		if(!userInfo){
			webtool.openPreView('login',function(wb){
				wb.show('slide-in-right',300);
			})
		}else{
	        news=plus.webview.getWebviewById("news");  
	        news.show() 
		}
          
    }) 
    mui("#nav").on("tap","#mineCenter",function(){//点击触发  
    	var userInfo=localStorage.getItem('userInfo');
		if(!userInfo){
			webtool.openPreView('login',function(wb){
				wb.show('slide-in-right',300);
			})
		}else{
	        mineCenter=plus.webview.getWebviewById("mineCenter");  
	        mineCenter.show()  
        }  
    }) 
});  